package com.xuecheng.order.dao;

import com.xuecheng.framework.domain.task.XcTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
/**
 * @author: gongfy
 * @create: 2020/9/24 16:09
 * @Description:
 */
@Repository
public interface XcTaskRepository extends JpaRepository<XcTask,String> {
    //更新version版本(乐观锁方式控制)
    @Modifying
    @Query("update XcTask x set x.version = :version+1 where x.id = :id and x.version = :version ")
    public int updateTaskVersion(@Param(value = "id") String id, @Param(value = "version") Integer version);
}
